<?php

namespace app\admin\controller\card;

use app\admin\controller\AuthController;
use app\admin\model\card\Card as CardModel;

/**
 * 卡管理
 * Class Card
 * @package app\admin\controller\card
 */
class Card extends AuthController
{

    /**
     * 获取会员卡的资料信息
     */
    public function index()
    {
        $type = $this->request->param("type");
        if ($type == null) $type = 10;
        $this->assign("card_type", 10);
        // 次数卡数量
        $time_card_num = CardModel::where("is_del", "0")->where("card_type", "10")->count();
        // 期限卡数量
        $date_card_num = CardModel::where("is_del", "0")->where("card_type", "20")->count();
        // 余额卡数量
        $money_card_num = CardModel::where("is_del", "0")->where("card_type", "30")->count();
        // 体验卡数量
        $us_card_num = CardModel::where("is_del", "0")->where("card_type", "40")->count();
        $this->assign(compact("type", "time_card_num", "date_card_num", "money_card_num", "us_card_num"));
        return $this->fetch();
    }

    /**
     * @tile 获取所有的会员卡的数据
     */
    public function card_list()
    {

    }
}